package BitCreeekClient;

import java.io.Serializable;
import java.net.Socket;

/**
 * Created by Ivan Litsvinenka e Emanuele Ricci
 * Date: 23-lug-2009
 * Time: 16.00.25
 */
public class PeerInfo implements IPeerInfo, Serializable {


    private Socket socket;
    private Part[] peerParts;

    private boolean connected;

    private long uploaded = 0;
    private long downloaded = 0;

    private long firstTimeDownloaded = -1;
    private long firstTimeUploaded = -1;

    public PeerInfo () {
        connected = false;
        socket = null;
        peerParts = null;
    }

    public PeerInfo ( Part[] parts ) {
        connected = false;
        this.setSocket ( null );
        this.setPeerParts ( parts );
    }

    public PeerInfo ( Socket socket, Part[] parts ) {
        connected = true;
        this.setSocket ( socket );
        this.setPeerParts ( parts );
    }

    public Part[] getPeerParts () {
        return peerParts;
    }

    public void setPeerParts ( Part[] peerParts ) {
        this.peerParts = peerParts;
    }

    public Socket getSocket () {
        return socket;
    }

    public void setSocket ( Socket socket ) {
        this.socket = socket;
    }

    public long getUploaded () {
        return uploaded;
    }

    public void setUploaded ( long uploaded ) {
        this.uploaded = uploaded;
    }

    public long getDownloaded () {
        return downloaded;
    }

    public void setDownloaded ( long downloaded ) {
        this.downloaded = downloaded;
    }

    public long getFirstTimeDownloaded () {
        return firstTimeDownloaded;
    }

    public void setFirstTimeDownloaded ( long firstTimeDownloaded ) {
        this.firstTimeDownloaded = firstTimeDownloaded;
    }

    public long getFirstTimeUploaded () {
        return firstTimeUploaded;
    }

    public void setFirstTimeUploaded ( long lastTimeUploaded ) {
        this.firstTimeUploaded = lastTimeUploaded;
    }

    public boolean isConnected () {
        return connected;
    }

    public void setConnected ( boolean connected ) {
        this.connected = connected;
    }
}
